package com.hgy.fxui.model;

import javafx.beans.property.*;
import lombok.*;

import java.time.LocalDate;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Drug {
    private Long id;
    private String name;
    private String specification;
    private String manufacturer;
    private Double price;
    private Integer stock;
    private LocalDate createTime;
    
    // JavaFX 属性访问器
    public IntegerProperty idProperty() {
        return new SimpleIntegerProperty(Math.toIntExact(id));
    }
    
    public StringProperty nameProperty() {
        return new SimpleStringProperty(name);
    }
    
    public StringProperty specificationProperty() {
        return new SimpleStringProperty(specification);
    }
    
    public StringProperty manufacturerProperty() {
        return new SimpleStringProperty(manufacturer);
    }
    
    public DoubleProperty priceProperty() {
        return new SimpleDoubleProperty(price);
    }
    
    public IntegerProperty stockProperty() {
        return new SimpleIntegerProperty(stock);
    }
}
